<template>
  <div class="login">
    login
    <van-button type="primary" @click="login">登录</van-button>
  </div>
</template>

<script lang="ts" setup>
import fetchApi from '@/api/user'
import {setToken} from "../../utils/auth";
import {router} from "../../router";
// import {Toast} from "vant";
// Toast('123')

const login = async()=>{
  const {data} = await fetchApi.login({userName:'admin',passWord:'123456'})
  setToken(data)
  await router.replace('/')
}

</script>

<style lang="less" scoped>
.login{
  font-size: 24px;
}
</style>
